import random
# 猜金币游戏
right_num = random.randint(1, 25)
for i in range(5):
    try:
        input_num = int(input("请输入一个数值"))
    except:
        print("输入的数值错误")
        continue
    if right_num == input_num:
        print("恭喜你获得一枚金币")
        break
    elif right_num > input_num:
        print(f"你猜的数字偏小, 还剩{4-i}次机会")
    else:
        print(f"你猜的数字偏大, 还剩{4-i}次机会")
else:
    print('game over')
